package com.vic.framework.utils;

import java.io.File;

import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 文件操作工具类
 * @author VIC
 *
 */
public final class FileUtil {

	private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
	
	/**
	 * 获取真实文件名(去掉文件路径)
	 */
	public static String getRealFileName(String filename){
		return FilenameUtils.getName(filename);
	}
	
	
	/**
	 * 创建文件
	 */
	public static File createFile(String filePath) {
		File file;
		try{
			file = new File(filePath);
		}catch(Exception e) {
			logger.error("create file failure", e);
			throw new RuntimeException(e);
		}
		return file;
	}
}
